<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>周期提醒</title>
<script type="text/javascript" src="${base}/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="${base}/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/js/messages_zh.js"></script>
<script src="js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${base}/js/jquery.ztree.all-3.4.min.js"></script>
<link rel="stylesheet" href="${base}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript">
function setdisplay1(){
	//alert(document.getElementById("pc1").checked);
    if(document.getElementById("pc1").checked){
      document.getElementById('day').style.display='';
      document.getElementById('day1').style.display='';
      document.getElementById('week').style.display='none';
      document.getElementById('weekday').style.display='none';
      document.getElementById('month').style.display='none';  
      document.getElementById("number2").value=''; 
      document.getElementById("number3").value='';
      document.getElementById("Monday").checked='';
      document.getElementById("Tuesday").checked='';
      document.getElementById("Wednesday").checked='';
      document.getElementById("Thursday").checked='';
      document.getElementById("Friday").checked='';
      document.getElementById("Saturday").checked='';
      document.getElementById("Sunday").checked='';    
    }
  //  alert(document.getElementById("pc2").checked);
    if(document.getElementById("pc2").checked){
        document.getElementById('day').style.display='none';
        document.getElementById('day1').style.display='none';
        document.getElementById('weekday').style.display='';
        document.getElementById('week').style.display='';
        document.getElementById('month').style.display='none'; 
        document.getElementById("number1").value=''; 
        document.getElementById("number3").value='';   
      }
  //  alert(document.getElementById("pc3").checked);
    if(document.getElementById("pc3").checked){
		document.getElementById('day').style.display='none';
		document.getElementById('day1').style.display='none';
        document.getElementById('weekday').style.display='none';
        document.getElementById('week').style.display='none';
        document.getElementById('month').style.display=''; 
        document.getElementById("number1").value=''; 
        document.getElementById("number2").value=''; 
        document.getElementById("Monday").checked='';
        document.getElementById("Tuesday").checked='';
        document.getElementById("Wednesday").checked='';
        document.getElementById("Thursday").checked='';
        document.getElementById("Friday").checked='';
        document.getElementById("Saturday").checked='';
        document.getElementById("Sunday").checked='';  
	}
   
}
window.onload=setdisplay1;
</script>
<script type="text/javascript">
function setnumber1(){
	if(document.getElementById("day11").checked){
		document.getElementById("number1").value='';
		}	
}

</script>
<script type="text/javascript">
function checkform(){
	if(document.getElementById("taskname").value==''){
		alert("请输入任务名称!");
		document.getElementById("taskname").focus();
		return false;
		}
	if(document.getElementById("remcontent").value==''){
		alert("请输入任务内容!");
		document.getElementById("remcontent").focus();
		return false;
		}
	if(document.getElementById("firsttime").value==''){
		alert("请输入第一次执行时间!");
		document.getElementById("firsttime").focus();
		return false;
		}
	if(document.getElementById("startdate").value==''){
		alert("请输入开始时间!");
		document.getElementById("startdate").focus();
		return false;
		}
	if(document.getElementById("enddate").value==''){
		alert("请输入结束时间!");
		document.getElementById("enddate").focus();
		return false;
		}
	if(document.getElementById("taskMemberStr").value==''){
		alert("请选择组员!");
		return false;
		}
		return true;
}
</script>
<script type="text/javascript">
var setting = {
		check: {
			enable: true
		},
		data: {
			simpleData: {
				enable: false
			}
		},
		callback:{
			onCheck:onCheck
		}
	};
	$(document).ready(function(){
		$.getJSON("${base}/remTask/findMember.nutz", function(zNodes){
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		});
	});

	  function onCheck(e,treeId,treeNode){
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				//只记录叶子节点权限ID.
				if(!nodes[i].isParent){
					if(v!=""){
						v += "," + nodes[i].value;
					}
					else{
						v += nodes[i].value;
					}
				}
			}
			//设置权限ID值。
			$("#taskMemberStr").val(v);
		}
</script>
</head>
 
<body>

<form method="post" id="cycledayForm" name="cycledayForm" action="${base}/save.nutz" onsubmit="return checkform();">
<input type="hidden" name="taskMemberStr" id="taskMemberStr"/>
<table width="80%" border="0" align="left" cellpadding="0" >
    <tr>
        <td colspan="2" align="left"><input name="remTask.rem_type" type="radio" value="0" onclick="javascript:location.href='remTask/create.nutz'"/>单次提醒</td>
        <td colspan="2" width="60%"><input name="remTask.rem_type" type="radio" value="1"  checked="checked"/>周期提醒</td>
    </tr>
    <!--<tr><td>任务编码</td><td><input id="task_id" name="remTask.task_id" type="text" value="${obj.task_id}"/></td></tr>
    --><tr>
    <td align="left">标题：</td><td align="left" colspan="3"><input id="taskname" name="remTask.task_name" type="text" value="标题" onclick="if(value=='标题'){value=''}" onblur="if(value==''){value='标题'}" size="74" /></td>
    </tr>
     <tr><td align="left">提醒内容：</td>
     <td align="left" colspan="3">
     <textarea name="remTask.rem_content" id="remcontent"  rows="5" cols="57"/></textarea></td>
     </tr>
    <tr><td align="left">提醒时间：</td><td align="left" colspan="3"><input id="firsttime" name="remTask.rem_first_time" type="text" value="${obj.rem_first_time}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"> </td><td>
    </td></tr>
    <tr><td colspan="4">定期模式</td></tr>
    <tr><td colspan="4">
    <table width="68%" border="1" align="left">
    
    <tr>
    <td colspan="2" align="left">
    <input id="pc1" name="remPlan.cycle_type" type="radio" value="0" onclick="setdisplay1();" checked="checked"/>按天
    </td>
    <td colspan="2">
    <span id="day" style="display:none">
    <input name="remPlan.plan_cycle" type="radio" value="00" checked="checked">每<input id="number1" name="remPlan.rem_cycle_number" type="text" value="${obj.rem_cycle_number}"/>天  </span>
    <br></br>
     <span id="day1" style="display:none">
     <input id="day11" name="remPlan.plan_cycle" type="radio" value="01" onclick="setnumber1();">每工作日
  </span>
    </td>
    </tr>
     <tr>
     <td colspan="2" align="left">
     <input id="pc2" name="remPlan.cycle_type"  type="radio" value="1"  onclick="setdisplay1();" />按周
     </td>
     <td colspan="2">
     <span id="week" style="display:none">每<input id="number2"name="remPlan.rem_cycle_number" type="text" size="5" value="${obj.rem_cycle_number}"/>周</span>
     	<br></br>
     <span id="weekday" style="display:none">
     <input id="Monday"  name="remPlan.plan_cycle"  type="checkbox" value="11"/>星期一
     <input id="Tuesday"  name="remPlan.plan_cycle" type="checkbox"  value="12"/>星期二
     <input id="Wednesday"  name="remPlan.plan_cycle" type="checkbox" value="13"/>星期三
     <input id="Thursday"  name="remPlan.plan_cycle" type="checkbox" value="14"/>星期四
     <input id="Friday"  name="remPlan.plan_cycle" type="checkbox" value="15"/>星期五
     <input id="Saturday" name="remPlan.plan_cycle" type="checkbox" value="16"/>星期六
     <input id="Sunday"  name="remPlan.plan_cycle" type="checkbox" value="17"/>星期日
     </span>
     
     </td>
     </tr>
      <tr>
      <td colspan="2" align="left">
      <input id="pc3" name="remPlan.cycle_type"  type="radio" value="2"  onclick="setdisplay1();" />按月
      </td>
      <td colspan="2">
      <span id="month" style="display:none">
      <input id="everymonth" type="hidden" name="remPlan.plan_cycle" value="20">每<input id="number3" name="remPlan.rem_cycle_number" type="text" value="${obj.rem_cycle_number}"/>月
      </span>
      </td>
      </tr>
      </table>
       </td></tr>
     <tr> <td align="left">有效状态：</td><td align="left" colspan="3">
                <select id="State" name="remTask.rem_status" > 
                    <option value="1">有效</option>
                    <option value="0">失效</option>
                </select>
            </td>
      <tr><td colspan="4">重复范围</td></tr>
       <tr><td  align="left">开始时间：</td><td align="left"><input id="startdate" name="remTask.rem_start_date" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  value="${obj.rem_start_date}"> 
       </td>
       <td colspan="2" align="left">结束时间：<input id="enddate" name="remTask.rem_end_date" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${obj.rem_end_date}"> </td>
       </tr>
    
    <tr>
    <td><input id="email"  name="remTask.rem_way" type="checkBox" value="0" checked />邮件</td>
    <td><input id=message name="remTask.rem_way" type="checkBox" value="1" />短信</td>
    </tr>
    <tr><td colspan="4">请选择通知人员</td></tr>
    <tr>
    	<td colspan="4">
    		<ul id="treeDemo" class="ztree"></ul>
		</td>
     </tr>
    <tr><td align="center" colspan="4"><input type="submit" name="queding" value="确定" />
    <input type="reset" name="quxiao" value="取消" /></td></tr>
</table>
</form>
</body>
</html>
